<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Blog
 * @copyright  Copyright 2006-2010 Webligo Developments
 * @license    http://www.socialengine.net/license/
 * @version    $Id: Core.php 8352 2011-01-31 22:30:22Z jung $
 * @author     Jung
 */

/**
 * @category   Application_Extensions
 * @package    Blog
 * @copyright  Copyright 2006-2010 Webligo Developments
 * @license    http://www.socialengine.net/license/
 */
class Sblog_Api_Core extends Core_Api_Abstract
{
	public function getBlogsPaginator($params = array()){
		$paginator = Zend_Paginator::factory($this->getSblogSelect($params));
	    if( !empty($params['page']) )
    	{
      		$paginator->setCurrentPageNumber($params['page']);
    	}
	    if( !empty($params['limit']) )
    	{
      		$paginator->setItemCountPerPage($params['limit']);
    	}
	    if( empty($params['limit']) )
    	{
      		//$page = (int) Engine_Api::_()->getApi('settings', 'core')->getSetting('blog.page', 10);
      		$page = 3;
    		$paginator->setItemCountPerPage($page);
    	}
		return $paginator;
	}
	public function getSblogSelect($params = array()){
		$table = Engine_Api::_()->getDbtable('sblogs', 'sblog');
    	$rName = $table->info('name');
    	$select = $table->select();
    	return $select ;
	}
}